# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=xmrig
pkgver=6.18.0
pkgrel=0
pkgdesc="XMRig is a high performance Monero (XMR) miner"
url="https://xmrig.com/"
arch="aarch64 x86 x86_64" # officially supported by upstream
license="GPL-3.0-or-later"
options="!check" # No test suite from upstream
makedepends="cmake libmicrohttpd-dev libuv-dev openssl-dev hwloc-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/xmrig/xmrig/archive/v$pkgver.tar.gz
	enable-donateless-mode.patch
	"

case "$CARCH" in
	aarch64*) CMAKE_CROSSOPTS="-DARM_TARGET=8"; makedepends="$makedepends linux-headers" ;;
esac

build() {
	cmake -B build $CMAKE_CROSSOPTS \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DWITH_CUDA=OFF \
		-DWITH_OPENCL=OFF

	cmake --build build
}

package() {
	install -Dm 755 build/xmrig $pkgdir/usr/bin/xmrig

	install -Dm 644 -t "$pkgdir"/usr/share/doc/$pkgname/ README.md
}

sha512sums="
ed20b760ae7603de752c933513c3f7abb2e254a44d79252264952f3e70c7b5320389ed4f6534a6dc8eb7cac8b1086239c46baf18c71f7ba7f0018914b2fd5917  xmrig-6.18.0.tar.gz
40cd7e3a884920951ec48efebbea5d7181deaeef6a226444a46ad8dc83b54eceae954c8d28952c21d63a15a4947eac72d1024b83684b5cb15437d3c8d32b006a  enable-donateless-mode.patch
"
